/* Basic editor styles */
.tiptap {
  :first-child {
    margin-top: 0;
  }

  /* List styles */
  ul,
  ol {
    padding: 0 1rem;
    margin: 1.25rem 1rem 1.25rem 0.4rem;

    li p {
      margin-top: 0.25em;
      margin-bottom: 0.25em;
    }
  }

  /* Heading styles */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    line-height: 1.1;
    margin-top: 2.5rem;
    text-wrap: pretty;
  }

  h1,
  h2 {
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  h4,
  h5,
  h6 {
    font-size: 1rem;
  }

  /* Code and preformatted text styles */
  code {
    background-color: var(--purple-light);
    border-radius: 0.4rem;
    color: var(--black);
    font-size: 0.85rem;
    padding: 0.25em 0.3em;
  }

  pre {
    background: var(--black);
    border-radius: 0.5rem;
    color: var(--white);
    font-family: 'JetBrainsMono', monospace;
    margin: 1.5rem 0;
    padding: 0.75rem 1rem;

    code {
      background: none;
      color: inherit;
      font-size: 0.8rem;
      padding: 0;
    }
  }

  blockquote {
    border-left: 3px solid var(--gray-3);
    margin: 1.5rem 0;
    padding-left: 1rem;
  }

  hr {
    border: none;
    border-top: 1px solid var(--gray-2);
    margin: 2rem 0;
  }

  /* Highlight specific styles */
  mark {
    background-color: #faf594;
    border-radius: 0.4rem;
    box-decoration-break: clone;
    padding: 0.1rem 0.3rem;
  }

  /* Task list specific styles */
  ul[data-type='taskList'] {
    list-style: none;
    margin-left: 0;
    padding: 0;

    li {
      align-items: flex-start;
      display: flex;

      > label {
        flex: 0 0 auto;
        margin-right: 0.5rem;
        user-select: none;
      }

      > div {
        flex: 1 1 auto;
      }
    }

    input[type='checkbox'] {
      cursor: pointer;
    }

    ul[data-type='taskList'] {
      margin: 0;
    }
  }

  p {
    word-break: break-all;
  }

  /* Give a remote user a caret */
  .collaboration-carets__caret {
    border-left: 1px solid #0d0d0d;
    border-right: 1px solid #0d0d0d;
    margin-left: -1px;
    margin-right: -1px;
    pointer-events: none;
    position: relative;
    word-break: normal;
  }

  /* Render the username above the caret */
  .collaboration-carets__label {
    border-radius: 3px 3px 3px 0;
    color: #0d0d0d;
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    left: -1px;
    line-height: normal;
    padding: 0.1rem 0.3rem;
    position: absolute;
    top: -1.4em;
    user-select: none;
    white-space: nowrap;
  }
}

.col-group {
  display: flex;
  flex-direction: row;
  height: 100vh;

  @media (max-width: 540px) {
    flex-direction: column;
  }
}

/* Column-half */
body {
  overflow: hidden;
}

.column-half {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: auto;

  &:last-child {
    border-left: 1px solid var(--gray-3);

    @media (max-width: 540px) {
      border-left: none;
      border-top: 1px solid var(--gray-3);
    }
  }

  & > .main-group {
    flex-grow: 1;
  }
}

/* Collaboration status */
.collab-status-group {
  align-items: center;
  background-color: var(--white);
  border-top: 1px solid var(--gray-3);
  bottom: 0;
  color: var(--gray-5);
  display: flex;
  flex-direction: row;
  font-size: 0.75rem;
  font-weight: 400;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.375rem 0.5rem 0.375rem 1rem;
  position: sticky;
  width: 100%;
  z-index: 100;

  button {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    align-self: stretch;
    background: none;
    display: -webkit-box;
    flex-shrink: 1;
    font-size: 0.75rem;
    max-width: 100%;
    padding: 0.25rem 0.375rem;
    overflow: hidden;
    position: relative;
    text-overflow: ellipsis;
    white-space: nowrap;

    &::before {
      background-color: var(--color);
      border-radius: 0.375rem;
      content: '';
      height: 100%;
      left: 0;
      opacity: 0.5;
      position: absolute;
      top: 0;
      transition: all 0.2s cubic-bezier(0.65, 0.05, 0.36, 1);
      width: 100%;
      z-index: -1;
    }

    &:hover::before {
      opacity: 1;
    }
  }

  label {
    align-items: center;
    display: flex;
    flex-direction: row;
    flex-shrink: 0;
    gap: 0.375rem;
    line-height: 1.1;

    &::before {
      border-radius: 50%;
      content: ' ';
      height: 0.35rem;
      width: 0.35rem;
    }
  }

  &[data-state='online'] {
    label {
      &::before {
        background-color: var(--green);
      }
    }
  }

  &[data-state='offline'] {
    label {
      &::before {
        background-color: var(--red);
      }
    }
  }
}
